package algorithm.leetcode.I201to400;

import java.util.PriorityQueue;

public class Q215 {

    public int findKthLargest(int[] nums, int k) {
        PriorityQueue<Integer> pq = new PriorityQueue<>((o1, o2) -> -o1.compareTo(o2));
        for (int num : nums) {
            pq.add(num);
        }
        int n = 0;
        for (int i = k; i > 0; i--) {
            n = pq.poll();
        }
        return n;


    }
}
